// components/ImageItem/ImageItem.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    postItem:{
      type:Object,
      value:null
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    time:""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 处理视频的时间
    getVideoTime(){
      let {duration} = this.properties.postItem;
      if (duration/1000>1) {
        duration=duration/1000
      }
      let m = Math.floor(duration/60) ;
      let s= Math.floor(duration%60);
      m= m<10?"0"+m:m;
      s= s<10?"0"+s:s;
      let str=`${m}:${s}`
      this.setData({
        time:str
      })
    }
  },
  attached(){
    this.getVideoTime();
  }
})
